import request from '@/utils/request';
import { PopularRecommend } from './model';

const prefix = '/marketing/popular';

export async function list(payload: PopularRecommend): Promise<any> {
  return request(prefix, {
    params: payload,
  });
}

export async function add(payload: PopularRecommend): Promise<any> {
  return request(prefix, {
    method: 'POST',
    data: payload,
  });
}

export async function addList(payload: PopularRecommend[]): Promise<any> {
  return request(`${prefix}/batch`, {
    method: 'POST',
    data: payload,
  });
}

export async function remove(id: number): Promise<any> {
  return request(`${prefix}/${id}`, {
    method: 'DELETE',
  });
}

export async function update(payload: PopularRecommend): Promise<any> {
  return request(`${prefix}/${payload.id}`, {
    method: 'PUT',
    data: payload,
  });
}
